#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    srand(time(0));

    QPushButton* getGeometry = new QPushButton(this);
    getGeometry->setText("geometry");
    getGeometry->move(100,100);
    connect(getGeometry,&QPushButton::clicked,this,&Widget::handle);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    QRect rect1 = this->geometry();
    QRect rect2 = this->frameGeometry();
    qDebug()<<rect1;
    qDebug()<<rect2;
}


void Widget::on_yes_clicked()
{
    ui->label->setText("太好了！");
}


void Widget::on_no_pressed()
{
    int widgetWidth = this->geometry().width();
    int widgetHeight = this -> geometry().height();

    int x = rand()%widgetWidth;
    int y = rand()%widgetHeight;

    ui->no->move(x,y);
}
